import request from '@/utils/request'

// 查询文章列表
export function listPost(query) {
  return request({
    url: '/publish/article/list',
    method: 'get',
    params: query
  })
}

// 查询文章 
export function getPost(articleId) {
  return request({
    url: '/publish/article/' + articleId,
    method: 'get'
  })
}

//新增文章
export function addPost(data) {
  return request({
    url: '/publish/article/add',
    method: 'post',
    data: data,
    headers: { 'Content-Type': 'multipart/form-data' } 
  })
}

// 修改文章
export function updatePost(data) {
  return request({
    url: '/publish/article/edit',
    method: 'put',
    data: data
  })
}

// 删除文章
export function delPost(articleId) {
  return request({
    url: '/publish/article/' + articleId,
    method: 'delete'
  })
}


//修改状态
export function updateStatus(data){
  return request({
    url: '/publish/article/updateStatus',
    method: 'put',
    data:data
  })
}
//异步
export function updateStatusSyn(data){
  return request({
    url: '/publish/article/updateStatu',
    method: 'put',
    data:data,
  })
}
